package org.example.dingtalkintegrationservice.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Repository;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;



/**
 * @author pc
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Value("${file.path}")
String filePath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 将文件目录映射到URL路径
        registry.addResourceHandler("/files/**")
                .addResourceLocations("file:"+filePath);
//                .addResourceLocations("file:I:/ZDLINK/dingfile/");
        // 或者使用 "file:E:\\standard\\"
    }


//    @Resource
//    private HttpLogInterceptor httpLogInterceptor;
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(httpLogInterceptor);
//    }
}
